home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / ActiveX Controlls / NCTAudioEditor2 ActiveX DLL / NCTAudioEditor2.exe / {app} / Samples / TestBCBAudioEditor2 / Info.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-10  |  3.0 KB  |  76 lines

  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #pragma hdrstop
  5.  
  6. #include "Info.h"
  7. #include "Main.h"
  8. //---------------------------------------------------------------------------
  9. #pragma package(smart_init)
  10. #pragma resource "*.dfm"
  11. TfrmInfo *frmInfo;
  12. //---------------------------------------------------------------------------
  13. __fastcall TfrmInfo::TfrmInfo(TComponent* Owner)
  14.     : TForm(Owner)
  15. {
  16.     for (int i = 0; i<148;i++){
  17.         //The list of genres is being filled with 148 elements using this cycle
  18.         infoGenre->Items->Add(frmMain->AudioEditor1->FileInfo->GenreToString(i));
  19.     }
  20. }
  21. //---------------------------------------------------------------------------
  22.  
  23. void TfrmInfo::ResetData()
  24. {
  25.     infoTitle->Text = Info->Title;
  26.     infoArtist->Text = Info->Artist;
  27.     infoAlbum->Text = Info->Album;
  28.     infoGenre->ItemIndex = Info->Genre;
  29.     infoCopyright->Text = Info->Copyright;
  30.     infoComment->Text = Info->Comments;
  31.     infoYear->Text = Info->Year;
  32.     infoTrack->Text = Info->Track;
  33.     infoComposer->Text = Info->Composer;
  34.     infoURL->Text = Info->URL;
  35.     infoEncodedBy->Text = Info->EncodedBy;
  36. }
  37. void __fastcall TfrmInfo::btnResetClick(TObject *Sender)
  38. {
  39.     ResetData();
  40. }
  41. //---------------------------------------------------------------------------
  42. void __fastcall TfrmInfo::btnApplyClick(TObject *Sender)
  43. {
  44.     Info->set_Title(StringToOleStr(infoTitle->Text));         //Sets a new title of the audio file subject
  45.     Info->set_Artist(StringToOleStr(infoArtist->Text));       //Sets a new name of the artist who created the original subject of the file
  46.     Info->set_Album(StringToOleStr(infoAlbum->Text));         //Sets a new Album name which contains the original audio file subject
  47.     Info->Genre = infoGenre->ItemIndex;    //Sets a new user-defined genre of the audio subject
  48.     Info->set_Copyright(StringToOleStr(infoCopyright->Text)); //Sets new copyright information for the audio file
  49.     Info->set_Comments(StringToOleStr(infoComment->Text));    //Sets new user-defined comments concerning an audio file
  50.     try{
  51.         Info->Year = infoYear->Text.ToInt();     //Sets the new year of the audio file//s subject to be first performed
  52.     }catch(...){
  53.         ShowMessage("Invalid Year Value");
  54.         infoYear->SetFocus();
  55.         return;
  56.     }
  57.     try{
  58.         Info->Track = infoTrack->Text.ToInt();
  59.     }catch(...){
  60.         ShowMessage("Invalid Track Value");
  61.         infoTrack->SetFocus();
  62.         return;
  63.     }
  64.     Info->set_URL(StringToOleStr(infoURL->Text));
  65.     Info->set_Composer(StringToOleStr(infoComposer->Text));
  66.     Info->set_EncodedBy(StringToOleStr(infoEncodedBy->Text));
  67. }
  68. //---------------------------------------------------------------------------
  69. void __fastcall TfrmInfo::FormShow(TObject *Sender)
  70. {
  71.     Info = frmMain->AudioEditor1->FileInfo;
  72.     ResetData();
  73. }
  74. //---------------------------------------------------------------------------
  75.  
  76.